﻿package org.leles.engines.beatgame 
{
	import flash.events.EventDispatcher;
	import org.leles.common.ITaggedObject;
	
	/**
	 * ...
	 * @author Bruno leles
	 */
	public class BeatGameNote extends BeatGameObject
	{
		/**
		 * when beat will ocour
		 */
		protected var _time:Number;
		
		/**
		 * when beat was hit
		 */
		protected var _hitTime:Number;
		
		/**
		 * what is the 'track' of the beat
		 */
		protected var _track:uint;
		
		/**
		 * "the duration" the length of the beat
		 */
		protected var _duration:Number;
		
		/**
		 * song of the note
		 */
		protected var _song:BeatGameSong;
		
		
		public function BeatGameNote(time:Number, track:uint, duration:Number = 0) 
		{
			super();
			_time	= time;
			_track	= track;
			_duration = duration;
		}
		
		public function get time():Number { return _time; }
		public function get track():uint { return _track; }
		public function get duration():Number { return _duration; }
		
		public function get hitAreaOffset():Number { return _time - engine.currentHitTime; }
		public function get absoluteHitAreaOffset():Number { return Math.abs(_time - engine.currentHitTime); }
		
		public function get hitTimeDelta():Number { return Math.abs(_hitTime - _time); }
		
		override public function get engine():BeatGameEngine { return _song ? _song.engine : null; }
		override public function set engine(value:BeatGameEngine):void 	{	/**\/	super.engine = value;	/**/	}	
		
		public function get song():BeatGameSong { return _song; }
		public function set song(value:BeatGameSong):void 	{ _song = value; }
		
		public function get hitTime():Number { return _hitTime; }
		public function set hitTime(value:Number):void		{ _hitTime = value; }
	}
}